package com.yuantu.judiciary.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 不良记录风险等级
 *
 * @author syw
 * @since 2023-07-06
 **/
@Getter
@AllArgsConstructor
public enum BadRecordRiskLevelType {

    /**
     * 未开通、无风险、低风险、中低风险、中风险、高风险、重大风险
     */
    NOT_OPEN("未开通"),
    NONE("无风险"),
    LOW("低风险"),
    MEDIUM_LOW("中低风险"),
    MEDIUM("中风险"),
    HIGH("高风险"),
    MAJOR("重大风险"),

    ;

    private final String value;

    public static BadRecordRiskLevelType fromValue(String value) {
        if (StringUtils.isBlank(value)) {
            return NONE;
        }

        for (BadRecordRiskLevelType badRecordRiskLevelType : values()) {
            if (badRecordRiskLevelType.getValue().equals(value)) {
                return badRecordRiskLevelType;
            }
        }
        return null;
    }

}
